#include <iostream>
#include <math.h>

class Complex
{
public:
    double parameter1, parameter2;
    Complex(double r = 0, double t = 0){parameter1 = r; parameter2 = t;}

    void printReal(){
        std::cout << " real is " << parameter1 << std::endl;
    }

    void printImag(){
        std::cout << " imag is " << parameter2 << std::endl;
    }
};

void getRealAndImag (double &parameter1, double &parameter2){
    double temp = parameter1;
    parameter1 = parameter1 * cos(parameter2);
    parameter2 = temp * sin(parameter2);
}

int main(int argc, char *argv[])
{
    Complex c(2.0, 3.14);//半径为2，角度约为π

    getRealAndImag(c.parameter1, c.parameter2);
    c.printReal();
    c.printImag();
    return 0;
}
